<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Iterator"%>
<%@ page import="com.wlcorp.forcazamis.domain.stock.StockProductDetail"%>
<%@ page import="com.wlcorp.forcazamis.domain.sample.Sample"%>
<%@ page import="com.wlcorp.forcazamis.sys.util.CommonUtil"%>
<%@ page import="com.wlcorp.forcazamis.sys.util.DateUtil" %>
<%@ page import="com.wlcorp.forcazamis.sys.util.ContextUtil" %>
<%
	List detailList = (List)request.getAttribute("detailList");
	String startDate = (String)request.getAttribute("startDate");
	String endDate = (String)request.getAttribute("endDate");
	Long amount=new Long(0);
	for(Iterator iter = detailList.iterator();iter.hasNext();){
  		StockProductDetail stockProductDetail = (StockProductDetail)iter.next();
  		amount+=stockProductDetail.getAmount();
	}
%>
<html>
<head>
<title>产品下单明细</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/common.js"></script>
</head>
<body bgcolor="#ffffff">
<center>
<table width="90%" border="0" cellspacing="1" cellpadding="0">
	<tr bgcolor="#E9EDF2">
		<td width="5%"><b>合计数量：<%=amount%>（付） &nbsp;
		<%if(startDate.equals("")){%>
			
		<%}else{ %>
			开始日期：<%=startDate%>   
			&nbsp;结束日期：<%=endDate%></b></td>
		<%}%>
	</tr>
</table>
<table width="90%" border="0" cellspacing="1" cellpadding="0" bgcolor="#999999">
	<tr bgcolor="#E7E7E7">
		<td class="bigtext" align="center" width="5%">序号</td>
		<td class="bigtext" align="center">产品(客户、工厂)型号</td>
		<td class="bigtext" align="center">来源一</td>
		<td class="bigtext" align="center">来源二</td>
		<td class="bigtext" align="center">来源三</td>
		<td class="bigtext" align="center">下单日期</td>
		<td class="bigtext" align="center">印字尺寸</td>
		<td class="bigtext" align="center">颜色描述</td>
		<td class="bigtext" align="center">单价</td>
		<td class="bigtext" align="center">数量</td>
		<td class="bigtext" align="center">订单号</td>
	</tr>
	<% 
          	int index = 0;
          	for(Iterator iter = detailList.iterator();iter.hasNext();){
          		StockProductDetail detail = (StockProductDetail)iter.next();
          		Sample sample=new Sample();
          		sample.setSampleCode(detail.getStockProduct().getMyCode());
          		List<Sample> sampleList = ContextUtil.getInstance().getSampleService().getSampleByCode(sample);
          		if(null!=sampleList&&sampleList.size()>0){
          			sample=sampleList.get(0);
          		}
          		index++;
          %>
	<tr bgcolor="#ffffff" onmouseover="this.style.backgroundColor='#bbdffb';" onmouseout="this.style.backgroundColor='#ffffff'">
		<td align="center" class="td5px"><%=index%></td>
		<td class="td5px"><a href="${pageContext.request.contextPath}/sample/sampleManager.do?method=getSample&sampleId=<%=sample.getSampleId()%>" target="_blank">
		<%=CommonUtil.nullToStr(detail.getStockProduct().getMyCode())%></a>
		&nbsp;[<%=CommonUtil.nullToStr(detail.getLetteringCode())%>]
		&nbsp;[<%=CommonUtil.nullToStr(detail.getStockProduct().getFactoryCode())%>]</td>
		<td class="td5px"></td>
		<td class="td5px"></td>
		<td class="td5px"></td>
		<td class="td5px"><%=DateUtil.toDateString(detail.getStockProduct().getStock().getStockDate())%></td>
		<td class="td5px"><%=CommonUtil.nullToStr(detail.getStockProduct().getOrderSize())%></td>
		<td class="td5px"><%=CommonUtil.nullToStr(detail.getShelfSurefaceColor())%></td>
		<td class="td5px"><%=CommonUtil.nullToStr(detail.getUnitPrice())%></td>
		<td class="td5px"><%=CommonUtil.nullToStr(detail.getAmount())%></td>
		<td class="td5px">
		<a href="${pageContext.request.contextPath}/stock/stockManager.do?method=printStock&stockId=<%=detail.getStockProduct().getStock().getStockId()%>" target="_blank">
		<%=CommonUtil.nullToStr(detail.getStockProduct().getStock().getStockCode())%></a>
		&nbsp;[<%=CommonUtil.nullToStr(detail.getStockProduct().getStock().getFactory().getFactoryName())%>]
		</td>
	</tr>
	<%}%>

</table>
<table>
	<tr>
		<td><%=request.getAttribute("pageURL")%></td>
	</tr>
</table>
</center>
${message}
</body>
</html>
